﻿using Microsoft.SharePoint.Linq;
using Microsoft.SharePoint;
using System.Linq;

using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

namespace VisualWebPartProject1.VisualWebPart1
{
    public partial class VisualWebPart1UserControl : UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            var dc = new SPLinqDataContext("http://sharepoint2010");
            var announcements = dc.Announcements;
            var announcementsQuery = from ann in announcements
                           select new
                           {
                               ann.Title,
                               ann.Version
                           };
            spGridView.DataSource = announcementsQuery;
            spGridView.DataBind();

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            //Label1.Text = "Hello World";
        }
    }
}
